package ModelLayer;

import java.util.ArrayList;
import java.util.Date;

public class ActivityBooking {
	private long ID;

	private ArrayList<Guest> guests;
	private Facility facility;
	private ActivityType activity;
	private Instructor instructor;
	private Date startHour;
	private Date creationTime;

	public ActivityBooking(long iD) {
		ID = iD;
		this.creationTime = new Date();
	}

	public ActivityBooking(long iD, Facility facility, ActivityType at,
			Date startHour) {
		ID = iD;
		this.creationTime = new Date();
		this.facility = facility;
		this.activity = at;
		this.startHour = startHour;
	}

	public ActivityBooking(long iD, Facility facility, ActivityType at,
			Date startHour, Instructor instructor) {
		ID = iD;
		this.creationTime = new Date();
		this.facility = facility;
		this.activity = at;
		this.startHour = startHour;
		this.instructor = instructor;
	}

	public ActivityBooking() {

	}

	public long getID() {
		return ID;
	}

	public Facility getFacility() {
		return facility;
	}

	public ActivityType getActivity() {
		return activity;
	}

	public Instructor getInstructor() {
		return instructor;
	}

	public Date getStartHour() {
		return startHour;
	}

	public Date getCreationTime() {
		return creationTime;
	}

	public void setID(long iD) {
		ID = iD;
	}

	public void setFacility(Facility facility) {
		this.facility = facility;
	}

	public void setActivity(ActivityType activity) {
		this.activity = activity;
	}

	public void setInstructor(Instructor instructor) {
		this.instructor = instructor;
	}

	public void setStartHour(Date startHour) {
		this.startHour = startHour;
	}

	public void setCreationTime(Date creationTime) {
		this.creationTime = creationTime;
	}

	public void addGuest(Guest guest) {
		if (this.activity.getMaxParticipants() > this.guests.size())
			this.guests.add(guest);
		else
			System.out.println("[ERROR] ModelLayer.ActivityBooking - Guest #"
					+ guest.getID() + "can not be added to activity #"
					+ this.getID() + ": Guest amount exceeded.");

		if (this.activity.getMinParticipants() > this.guests.size())
			System.out
					.println("[WARNING] ModelLayer.ActivityBooking - Guests amount ("
							+ this.guests.size()
							+ ") is smaller than required participants ("
							+ this.activity.getMinParticipants() + ")");
	}

	public void removeGuest(Guest guest) {
		this.guests.remove(guest);
	}

	public ArrayList<Guest> getGuests() {
		return this.guests;
	}

}
